﻿using MonitorPrism_Practice.Model;
using SCADALight.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace MonitorPrism_Practice.Services
{
    public class LogEventService
    {
        public ObservableCollection<LogEventModel> Items { get; set; } = new ObservableCollection<LogEventModel>();
        private IEventAggregator _aggregator { get; }
        public LogEventService(IEventAggregator aggregator)
        {
            _aggregator = aggregator;
        }

        public void AddItem(LogEventModel item)
        {
            //Items.Add(item);
            _aggregator.GetEvent<LogEvent>().Publish(item);
        }
    }

    public class ReciveDataEventService
    {
        private IEventAggregator _aggregator { get; }
        public ReciveDataEventService(IEventAggregator aggregator)
        {
            _aggregator = aggregator;
        }

        public void AddItem(InterfaceReciveDataModel item)
        {
            //Items.Add(item);
            _aggregator.GetEvent<ReciveDataEvent>().Publish(item);
        }
    }
    public class WriteDataEventService
    {
        private IEventAggregator _aggregator { get; }
        public WriteDataEventService(IEventAggregator aggregator)
        {
            _aggregator = aggregator;
            //1
            //2
            //4
            //5
            //6

        }

        public void AddItem(InterfaceWriteDataModel item)
        {
            //Items.Add(item);
            _aggregator.GetEvent<WriteDataEvent>().Publish(item);
            //5
        }
    }
}
